--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit efc24d361b1917456b9eba17a21e7d8bd877f144
Parents : 848514e
Author : Mark Qvist <mark@unsigned.io>
Date : 2021-09-25T16:57:29+02:00
Added node saving from announce stream
Changes
3 files changed, 21 insertions(+), 7 deletions(-)
Diff
diff --git a/nomadnet/NomadNetworkApp.py b/nomadnet/NomadNetworkApp.py
index 4747d80..862b50c 100644
--- a/nomadnet/NomadNetworkApp.py
+++ b/nomadnet/NomadNetworkApp.py
@@ -436,8 +436,8 @@ announce_at_start = yes
intro_time = 1
# You can specify the display theme.
-# theme = dark
-theme = light
+# theme = light
+theme = dark
# Specify the number of colors to use
# valid colormodes are:
@@ -492,12 +492,12 @@ enable_node = no
node_name = None
# Automatic announce interval in minutes.
-# 12 hours by default.
+# 6 hours by default.
-announce_interval = 720
+announce_interval = 360
# Whether to announce when the node starts
-announce_at_start = No
+announce_at_start = Yes
'''.splitlines()
\ No newline at end of file
diff --git a/nomadnet/ui/textui/Conversations.py b/nomadnet/ui/textui/Conversations.py
index e1018af..6d5ac1c 100644
--- a/nomadnet/ui/textui/Conversations.py
+++ b/nomadnet/ui/textui/Conversations.py
@@ -423,7 +423,8 @@ class ConversationsDisplay():
if trust_level != DirectoryEntry.TRUSTED:
display_text += " <"+source_hash+">"
- else:
+
+ if trust_level != DirectoryEntry.UNTRUSTED:
if unread:
if source_hash != self.currently_displayed_conversation:
display_text += " "+g["unread"]
diff --git a/nomadnet/ui/textui/Network.py b/nomadnet/ui/textui/Network.py
index af6edf9..66a589d 100644
--- a/nomadnet/ui/textui/Network.py
+++ b/nomadnet/ui/textui/Network.py
@@ -110,6 +110,12 @@ class AnnounceInfo(urwid.WidgetWrap):
self.parent.browser.retrieve_url(RNS.hexrep(source_hash, delimit=False))
show_announce_stream(None)
+ def save_node(sender):
+ node_entry = DirectoryEntry(source_hash, display_name=data_str, trust_level=trust_level, hosts_node=True)
+ self.app.directory.remember(node_entry)
+ self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
+ show_announce_stream(None)
+
def converse(sender):
show_announce_stream(None)
try:
@@ -133,8 +139,15 @@ class AnnounceInfo(urwid.WidgetWrap):
if is_node:
type_button = ("weight", 0.45, urwid.Button("Connect", on_press=connect))
+ save_button = ("weight", 0.45, urwid.Button("Save", on_press=save_node))
else:
type_button = ("weight", 0.45, urwid.Button("Converse", on_press=converse))
+ save_button = None
+
+ if is_node:
+ button_columns = urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), save_button, ("weight", 0.1, urwid.Text("")), type_button])
+ else:
+ button_columns = urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), type_button])
pile_widgets = [
urwid.Text("Time : "+ts_string, align="left"),
@@ -145,7 +158,7 @@ class AnnounceInfo(urwid.WidgetWrap):
urwid.Divider(g["divider1"]),
urwid.Text(["Announce Data: \n", (data_style, data_str)], align="left"),
urwid.Divider(g["divider1"]),
- urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), type_button])
+ button_columns
]
if is_node:
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────